package cn.xz.tipsum.adapter

import android.graphics.Color
import android.widget.TextView
import cn.xz.tipsum.R
import cn.xz.tipsum.bean.MyBean
import cn.xz.tipsum.utils.SessionUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * 内容列表适配器*/
class MyTwoListAdapter : BaseQuickAdapter<MyBean, BaseViewHolder>(R.layout.item_my_two_list) {

    override fun convert(holder: BaseViewHolder, item: MyBean) {
        //ID
        val mID = holder.getView<TextView>(R.id.tv_id)
        //类型
        val mType = holder.getView<TextView>(R.id.tv_type)
        //金钱
        val mValue = holder.getView<TextView>(R.id.tv_value)
        //时间
        val mTime = holder.getView<TextView>(R.id.tv_time)

        //类型
        var mC = SessionUtils.getInt(SessionUtils.COLOR_WX,Color.parseColor("#FFFFFF"))
        var mT = "微"
        if (item.type == "Z"){
            mC = SessionUtils.getInt(SessionUtils.COLOR_ZFB,Color.parseColor("#1E90FF"))
            mT = "支"
        }

        mID.setTextColor(mC)
        mType.setTextColor(mC)
        mValue.setTextColor(mC)

        mID.text = (holder.layoutPosition + 1).toString()
        mType.text = mT
        mValue.text = "${item.value}元"
        mTime.text = item.time

    }
}